package cn.ljy.mes.model;

import cn.ljy.authority.model.SysUser;
import cn.ljy.common.model.BaseModel;
import cn.ljy.common.model.validate.AddWorkValidation;
import cn.ljy.common.model.validate.UpdateWorkValidation;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import javax.validation.constraints.NotNull;
import java.util.Date;

/**
 * 生产步骤记录实体类
 */
@ApiModel(value = "生产步骤记录")
@Data
@NoArgsConstructor
@EqualsAndHashCode(callSuper = false, of = {"id"})
public class MesProductionOrderStep extends BaseModel {

    @ApiModelProperty(value = "步骤记录ID", example = "01f15383-7cb4-11f0-92a2-0250f2000002")
    @NotNull(groups = UpdateWorkValidation.class, message = "步骤记录ID不能为空")
    private String id;

    @ApiModelProperty(value = "生产工单ID", required = true)
    @NotNull(groups = AddWorkValidation.class, message = "生产工单不能为空")
    private MesProductionOrder productionOrder;

    @ApiModelProperty(value = "工艺明细", required = true)
//    @NotNull(groups = AddWorkValidation.class, message = "工艺明细不能为空")
    private MesCarTechnologyDetail carTechnologyDetail;

    @ApiModelProperty(value = "物料批次", required = true)
    @NotNull(groups = UpdateWorkValidation.class, message = "物料批次不能为空")
    private WmsMaterialBatch materialBatch;

    @ApiModelProperty(value = "物料批次ID",notes = "仅用于数据库检索（虽然有关联字段materialBatch，但是关联字段需要连表查询，故针对检索频率高的字段加上这个），不作为查询条件、插入、更新、删除的依据字段")
    private String materialBatchId;//物料批次ID，

    @ApiModelProperty(value = "实际用量", example = "95")
    @NotNull(groups = UpdateWorkValidation.class, message = "实际用量不能为空")
    private Long actualQuantity;

    @ApiModelProperty(value = "操作员", required = true)
    private SysUser operator;

    @ApiModelProperty(value = "开始时间", example = "2025-08-18 12:28:26")
    private Date startTime;

    @ApiModelProperty(value = "完成时间", example = "2025-08-19 12:29:32")
    private Date endTime;

    @ApiModelProperty(value = "步骤状态", required = true,
            allowableValues = "pending,in_progress,completed,audit_passed,audit_failed",
            example = "pending")
    private String status;

    @ApiModelProperty(value = "审核员")
    private SysUser auditor;

    @ApiModelProperty(value = "审核时间", example = "2025-08-19 12:30:00")
    private Date auditTime;

    @ApiModelProperty(value = "审核结果", example = "2025-08-19 12:30:00")
    private Boolean auditResult;

    @ApiModelProperty(value = "审核意见", example = "用料符合标准")
    private String auditNote;

    @ApiModelProperty(value = "创建时间", required = true, example = "2025-08-19 12:29:32")
    private Date createTime;

    @ApiModelProperty(value = "更新时间", required = true, example = "2025-08-19 12:30:00")
    private Date updateTime;

    public MesProductionOrderStep(String id) {
        this.id = id;
    }
}